#ifndef __SUMMON_MANAGER_H__
#define __SUMMON_MANAGER_H__

#pragma once

#include <Singleton.h>
#include <SolarHashTable.h>
#include <MemoryPoolFactory.h>

using namespace util;

class SummonedNPCs;
class Character;

class SummonManager : public Singleton<SummonManager>
{
public:
	SummonManager();
	~SummonManager();

	VOID				Release();
	VOID				Init( DWORD dwMaxPoolSize );

	SummonedNPCs*		AllocSummonNPCs( Character *pSummoner, BOOL bPlayerSkill );
	BOOL				FreeSummonNPCs( SummonedNPCs *pSummonNPCs );

	VOID				AddSummonedSkill( DWORD dwSummonKey, SLOTCODE SkillCode );
	VOID				DelSummonedSkill( DWORD dwSummonKey, SLOTCODE SkillCode );

	VOID				LeaveSummonNPCs( Character *pLeaveChar );

	RC::eSUMMON_RESULT	SetCommandState( DWORD dwSummonKey, eSUMMON_COMMAND eCommand, DWORD dwObjectKey=0, DWORD dwTargetKey=0 );

	SummonedNPCs*		FindSummonNPCs( DWORD dwSummonKey )		{ return m_pSummonNPCsList->GetData( dwSummonKey ); }

private:
	CMemoryPoolFactory<SummonedNPCs> *				m_pSummonNPCsPool;
	util::SolarHashTable<SummonedNPCs *, DWORD> *	m_pSummonNPCsList;
};

#endif // __SUMMON_MANAGER_H__
